"""Added VPNServer model

Revision ID: 637a4ff99008
Revises: 20442f98b0ae
Create Date: 2023-05-08 12:15:21.717387

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "637a4ff99008"
down_revision = "20442f98b0ae"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "vpn_server",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column(
            "status",
            sa.Enum("active", "inactive"),
            server_default="active",
            nullable=True,
        ),
        sa.Column("name", sa.String(length=255), nullable=True),
        sa.Column("description", sa.String(length=255), nullable=True),
        sa.Column("ip_address", sa.String(length=100), nullable=False),
        sa.Column("ssh_port", sa.Integer(), nullable=False),
        sa.Column("login", sa.String(length=100), nullable=False),
        sa.Column("password", sa.String(length=100), nullable=False),
        sa.Column("was_added", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.add_column("order", sa.Column("vpn_server_id", sa.Integer(), nullable=True))
    op.create_foreign_key(None, "order", "vpn_server", ["vpn_server_id"], ["id"])
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "order", type_="foreignkey")
    op.drop_column("order", "vpn_server_id")
    op.drop_table("vpn_server")
    # ### end Alembic commands ###
